package com.hundun.controller;


import com.hundun.domain.Result;
import com.hundun.domain.Vo.SignatureVo;
import com.hundun.util.FontUtils;
import com.hundun.util.ImageUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.awt.*;
import java.io.IOException;

/**
 * 姓名小程序业务1
 */
@Api(tags = "姓名小程序")
@RestController
@RequestMapping("sig")
public class SigController {




    /**
     * 签名程序
     *
     * @param signatureVo
     * @return
     */
    @PostMapping("/img")
    @ApiOperation("签名图片")
    public Result<?> getImg(@RequestBody SignatureVo signatureVo) throws IOException {
        Font systemFont = FontUtils.getFont(signatureVo.getFontType(), 130);
        String desImageFile = ImageUtils.pressText(signatureVo.getUserName(), "e:/img/123.jpg", "e:/img/1234.jpg",
                Color.BLACK, systemFont,
                0, 0, 0.5f);
        String url = ImageUtils.getQinNiuUrl(desImageFile);
        return Result.success("字体生成成功！", url);
    }



}
